<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    function  Father(name,age){
        this.name =name;
        this.age=age;
        function setName(name){
            this.name=name;
        }
    }

    Father.prototype.setAge = function (age){
        this.age=age;
    }


    //call方法改变father中 this 的指向
    function Sun(name,age){
        Father.call(this,name,age)
    }

    Sun.prototype = new Father()  // __proto__  指向 Father.prototype
    Sun.prototype.constructor = Sun   //指向sun


    let ss=new Sun()
    ss.setAge(20)  //通过原型链调用 father 中的方法

    console.log(ss.age)

</script>
</body>
</html>